.class public abstract Lcom/openfeint/internal/request/BaseRequest;
.super Ljava/lang/Object;
.source "BaseRequest.java"


# static fields
.field private static DEFAULT_RETRIES:I

.field private static DEFAULT_TIMEOUT:J

.field protected static TAG:Ljava/lang/String;

.field private static sBaseServerURL:Ljava/lang/String;


# instance fields
.field protected mArgs:Lcom/openfeint/internal/request/OrderedArgList;

.field private mCurrentURL:Ljava/lang/String;

.field private mFuture:Ljava/util/concurrent/Future;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/concurrent/Future",
            "<*>;"
        }
    .end annotation
.end field

.field private mHttpParams:Lorg/apache/http/params/HttpParams;

.field private mKey:Ljava/lang/String;

.field private mRequest:Lorg/apache/http/client/methods/HttpUriRequest;

.field private mResponded:Z

.field private mResponseBody:[B

.field private mResponseCode:I

.field private mResponseEncoding:Ljava/lang/String;

.field private mResponseType:Ljava/lang/String;

.field private mRetriesLeft:I

.field private mSecondsSinceEpoch:J

.field private mSignature:Ljava/lang/String;

.field private response_:Lorg/apache/http/HttpResponse;


# direct methods
.method static constructor <clinit>()V
    .locals 2

    .prologue
    .line 34
    const/4 v0, 0x2

    sput v0, Lcom/openfeint/internal/request/BaseRequest;->DEFAULT_RETRIES:I

    .line 35
    const-wide/16 v0, 0x4e20

    sput-wide v0, Lcom/openfeint/internal/request/BaseRequest;->DEFAULT_TIMEOUT:J

    .line 37
    const-string v0, "Request"

    sput-object v0, Lcom/openfeint/internal/request/BaseRequest;->TAG:Ljava/lang/String;

    .line 47
    const/4 v0, 0x0

    sput-object v0, Lcom/openfeint/internal/request/BaseRequest;->sBaseServerURL:Ljava/lang/String;

    .line 32
    return-void
.end method

.method public constructor <init>()V
    .locals 2

    .prologue
    const/4 v1, 0x0

    const/4 v0, 0x0

    .line 96
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 41
    iput-boolean v1, p0, Lcom/openfeint/internal/request/BaseRequest;->mResponded:Z

    .line 42
    iput-object v0, p0, Lcom/openfeint/internal/request/BaseRequest;->mResponseEncoding:Ljava/lang/String;

    .line 43
    iput-object v0, p0, Lcom/openfeint/internal/request/BaseRequest;->mResponseType:Ljava/lang/String;

    .line 49
    iput-object v0, p0, Lcom/openfeint/internal/request/BaseRequest;->mSignature:Ljava/lang/String;

    .line 50
    iput-object v0, p0, Lcom/openfeint/internal/request/BaseRequest;->mKey:Ljava/lang/String;

    .line 51
    iput v1, p0, Lcom/openfeint/internal/request/BaseRequest;->mRetriesLeft:I

    .line 56
    iput-object v0, p0, Lcom/openfeint/internal/request/BaseRequest;->mCurrentURL:Ljava/lang/String;

    .line 59
    iput-object v0, p0, Lcom/openfeint/internal/request/BaseRequest;->mFuture:Ljava/util/concurrent/Future;

    .line 61
    iput-object v0, p0, Lcom/openfeint/internal/request/BaseRequest;->mHttpParams:Lorg/apache/http/params/HttpParams;

    .line 97
    return-void
.end method

.method public constructor <init>(Lcom/openfeint/internal/request/OrderedArgList;)V
    .locals 2
    .parameter "args"

    .prologue
    const/4 v1, 0x0

    const/4 v0, 0x0

    .line 100
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 41
    iput-boolean v1, p0, Lcom/openfeint/internal/request/BaseRequest;->mResponded:Z

    .line 42
    iput-object v0, p0, Lcom/openfeint/internal/request/BaseRequest;->mResponseEncoding:Ljava/lang/String;

    .line 43
    iput-object v0, p0, Lcom/openfeint/internal/request/BaseRequest;->mResponseType:Ljava/lang/String;

    .line 49
    iput-object v0, p0, Lcom/openfeint/internal/request/BaseRequest;->mSignature:Ljava/lang/String;

    .line 50
    iput-object v0, p0, Lcom/openfeint/internal/request/BaseRequest;->mKey:Ljava/lang/String;

    .line 51
    iput v1, p0, Lcom/openfeint/internal/request/BaseRequest;->mRetriesLeft:I

    .line 56
    iput-object v0, p0, Lcom/openfeint/internal/request/BaseRequest;->mCurrentURL:Ljava/lang/String;

    .line 59
    iput-object v0, p0, Lcom/openfeint/internal/request/BaseRequest;->mFuture:Ljava/util/concurrent/Future;

    .line 61
    iput-object v0, p0, Lcom/openfeint/internal/request/BaseRequest;->mHttpParams:Lorg/apache/http/params/HttpParams;

    .line 101
    invoke-virtual {p0, p1}, Lcom/openfeint/internal/request/BaseRequest;->setArgs(Lcom/openfeint/internal/request/OrderedArgList;)V

    .line 102
    return-void
.end method

.method static synthetic access$0(Lcom/openfeint/internal/request/BaseRequest;Ljava/lang/String;)V
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 56
    iput-object p1, p0, Lcom/openfeint/internal/request/BaseRequest;->mCurrentURL:Ljava/lang/String;

    return-void
.end method

.method static synthetic access$1(Lcom/openfeint/internal/request/BaseRequest;[B)V
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 40
    iput-object p1, p0, Lcom/openfeint/internal/request/BaseRequest;->mResponseBody:[B

    return-void
.end method

.method static synthetic access$2(Lcom/openfeint/internal/request/BaseRequest;I)V
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 46
    iput p1, p0, Lcom/openfeint/internal/request/BaseRequest;->mResponseCode:I

    return-void
.end method

.method static synthetic access$3(Lcom/openfeint/internal/request/BaseRequest;Ljava/lang/String;)V
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 42
    iput-object p1, p0, Lcom/openfeint/internal/request/BaseRequest;->mResponseEncoding:Ljava/lang/String;

    return-void
.end method

.method static synthetic access$4(Lcom/openfeint/internal/request/BaseRequest;Ljava/lang/String;)V
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 43
    iput-object p1, p0, Lcom/openfeint/internal/request/BaseRequest;->mResponseType:Ljava/lang/String;

    return-void
.end method

.method static synthetic access$5(Lcom/openfeint/internal/request/BaseRequest;)[B
    .locals 1
    .parameter

    .prologue
    .line 40
    iget-object v0, p0, Lcom/openfeint/internal/request/BaseRequest;->mResponseBody:[B

    return-object v0
.end method

.method static synthetic access$6(Lcom/openfeint/internal/request/BaseRequest;)Lorg/apache/http/client/methods/HttpUriRequest;
    .locals 1
    .parameter

    .prologue
    .line 39
    iget-object v0, p0, Lcom/openfeint/internal/request/BaseRequest;->mRequest:Lorg/apache/http/client/methods/HttpUriRequest;

    return-object v0
.end method

.method static synthetic access$7(Lcom/openfeint/internal/request/BaseRequest;Lorg/apache/http/HttpResponse;)V
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 181
    iput-object p1, p0, Lcom/openfeint/internal/request/BaseRequest;->response_:Lorg/apache/http/HttpResponse;

    return-void
.end method

.method private fakeServerException(Lcom/openfeint/internal/resource/ServerException;)V
    .locals 1
    .parameter "se"

    .prologue
    .line 283
    const/4 v0, 0x0

    iput v0, p0, Lcom/openfeint/internal/request/BaseRequest;->mResponseCode:I

    .line 284
    invoke-virtual {p1}, Lcom/openfeint/internal/resource/ServerException;->generate()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/String;->getBytes()[B

    move-result-object v0

    iput-object v0, p0, Lcom/openfeint/internal/request/BaseRequest;->mResponseBody:[B

    .line 285
    const-string v0, "application/json;"

    iput-object v0, p0, Lcom/openfeint/internal/request/BaseRequest;->mResponseType:Ljava/lang/String;

    .line 286
    return-void
.end method


# virtual methods
.method protected final addParams(Lorg/apache/http/client/methods/HttpUriRequest;)V
    .locals 1
    .parameter "retval"

    .prologue
    .line 177
    iget-object v0, p0, Lcom/openfeint/internal/request/BaseRequest;->mHttpParams:Lorg/apache/http/params/HttpParams;

    if-eqz v0, :cond_0

    .line 178
    iget-object v0, p0, Lcom/openfeint/internal/request/BaseRequest;->mHttpParams:Lorg/apache/http/params/HttpParams;

    invoke-interface {p1, v0}, Lorg/apache/http/client/methods/HttpUriRequest;->setParams(Lorg/apache/http/params/HttpParams;)V

    .line 180
    :cond_0
    return-void
.end method

.method protected currentURL()Ljava/lang/String;
    .locals 1

    .prologue
    .line 57
    iget-object v0, p0, Lcom/openfeint/internal/request/BaseRequest;->mCurrentURL:Ljava/lang/String;

    if-eqz v0, :cond_0

    iget-object v0, p0, Lcom/openfeint/internal/request/BaseRequest;->mCurrentURL:Ljava/lang/String;

    :goto_0
    return-object v0

    :cond_0
    invoke-virtual {p0}, Lcom/openfeint/internal/request/BaseRequest;->url()Ljava/lang/String;

    move-result-object v0

    goto :goto_0
.end method

.method public final exec(Z)V
    .locals 12
    .parameter "forceFailure"

    .prologue
    const/4 v11, 0x1

    const/4 v10, 0x0

    const/4 v9, 0x0

    .line 183
    invoke-virtual {p0}, Lcom/openfeint/internal/request/BaseRequest;->generateRequest()Lorg/apache/http/client/methods/HttpUriRequest;

    move-result-object v6

    iput-object v6, p0, Lcom/openfeint/internal/request/BaseRequest;->mRequest:Lorg/apache/http/client/methods/HttpUriRequest;

    .line 185
    invoke-virtual {p0}, Lcom/openfeint/internal/request/BaseRequest;->numRetries()I

    move-result v6

    iput v6, p0, Lcom/openfeint/internal/request/BaseRequest;->mRetriesLeft:I

    .line 187
    iput-object v9, p0, Lcom/openfeint/internal/request/BaseRequest;->mResponseBody:[B

    .line 188
    iput v10, p0, Lcom/openfeint/internal/request/BaseRequest;->mResponseCode:I

    .line 189
    iput-object v9, p0, Lcom/openfeint/internal/request/BaseRequest;->response_:Lorg/apache/http/HttpResponse;

    .line 192
    iget-object v6, p0, Lcom/openfeint/internal/request/BaseRequest;->mRequest:Lorg/apache/http/client/methods/HttpUriRequest;

    invoke-interface {v6}, Lorg/apache/http/client/methods/HttpUriRequest;->getURI()Ljava/net/URI;

    move-result-object v6

    invoke-virtual {v6}, Ljava/net/URI;->getPath()Ljava/lang/String;

    move-result-object v4

    .line 193
    .local v4, path:Ljava/lang/String;
    const-string v6, "//"

    invoke-virtual {v4, v6}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z

    move-result v6

    if-eqz v6, :cond_3

    .line 195
    new-instance v5, Lcom/openfeint/internal/resource/ServerException;

    invoke-direct {v5}, Lcom/openfeint/internal/resource/ServerException;-><init>()V

    .line 196
    .local v5, se:Lcom/openfeint/internal/resource/ServerException;
    const-string v6, "RequestError"

    iput-object v6, v5, Lcom/openfeint/internal/resource/ServerException;->exceptionClass:Ljava/lang/String;

    .line 197
    const v6, 0x7f04002b

    invoke-static {v6}, Lcom/openfeint/internal/OpenFeintInternal;->getRString(I)Ljava/lang/String;

    move-result-object v6

    iput-object v6, v5, Lcom/openfeint/internal/resource/ServerException;->message:Ljava/lang/String;

    .line 198
    iput-boolean v11, v5, Lcom/openfeint/internal/resource/ServerException;->needsDeveloperAttention:Z

    .line 199
    invoke-direct {p0, v5}, Lcom/openfeint/internal/request/BaseRequest;->fakeServerException(Lcom/openfeint/internal/resource/ServerException;)V

    .line 279
    .end local v5           #se:Lcom/openfeint/internal/resource/ServerException;
    :goto_0
    iget v6, p0, Lcom/openfeint/internal/request/BaseRequest;->mResponseCode:I

    iget-object v7, p0, Lcom/openfeint/internal/request/BaseRequest;->mResponseBody:[B

    invoke-virtual {p0, v6, v7}, Lcom/openfeint/internal/request/BaseRequest;->onResponseOffMainThread(I[B)V

    .line 280
    return-void

    .line 204
    :cond_0
    if-eqz p1, :cond_2

    .line 205
    const/4 v6, 0x0

    :try_start_0
    iput v6, p0, Lcom/openfeint/internal/request/BaseRequest;->mRetriesLeft:I

    .line 206
    new-instance v6, Ljava/lang/Exception;

    const-string v7, "Forced failure"

    invoke-direct {v6, v7}, Ljava/lang/Exception;-><init>(Ljava/lang/String;)V

    throw v6
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    .line 255
    :catch_0
    move-exception v6

    move-object v2, v6

    .line 256
    .local v2, e:Ljava/lang/Exception;
    sget-object v6, Lcom/openfeint/internal/request/BaseRequest;->TAG:Ljava/lang/String;

    new-instance v7, Ljava/lang/StringBuilder;

    const-string v8, "Error executing request \'"

    invoke-direct {v7, v8}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {p0}, Lcom/openfeint/internal/request/BaseRequest;->path()Ljava/lang/String;

    move-result-object v8

    invoke-virtual {v7, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v7

    const-string v8, "\'."

    invoke-virtual {v7, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v7

    invoke-virtual {v7}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v7

    invoke-static {v6, v7}, Lcom/openfeint/internal/OpenFeintInternal;->log(Ljava/lang/String;Ljava/lang/String;)V

    .line 257
    sget-object v6, Ljava/lang/System;->err:Ljava/io/PrintStream;

    invoke-virtual {v2, v6}, Ljava/lang/Exception;->printStackTrace(Ljava/io/PrintStream;)V

    .line 260
    iput-object v9, p0, Lcom/openfeint/internal/request/BaseRequest;->mResponseBody:[B

    .line 261
    iput v10, p0, Lcom/openfeint/internal/request/BaseRequest;->mResponseCode:I

    .line 262
    iput-object v9, p0, Lcom/openfeint/internal/request/BaseRequest;->response_:Lorg/apache/http/HttpResponse;

    .line 264
    iget v6, p0, Lcom/openfeint/internal/request/BaseRequest;->mRetriesLeft:I

    sub-int/2addr v6, v11

    iput v6, p0, Lcom/openfeint/internal/request/BaseRequest;->mRetriesLeft:I

    if-gez v6, :cond_3

    .line 266
    new-instance v5, Lcom/openfeint/internal/resource/ServerException;

    invoke-direct {v5}, Lcom/openfeint/internal/resource/ServerException;-><init>()V

    .line 267
    .restart local v5       #se:Lcom/openfeint/internal/resource/ServerException;
    invoke-virtual {v2}, Ljava/lang/Object;->getClass()Ljava/lang/Class;

    move-result-object v6

    invoke-virtual {v6}, Ljava/lang/Class;->getName()Ljava/lang/String;

    move-result-object v6

    iput-object v6, v5, Lcom/openfeint/internal/resource/ServerException;->exceptionClass:Ljava/lang/String;

    .line 268
    invoke-virtual {v2}, Ljava/lang/Exception;->getMessage()Ljava/lang/String;

    move-result-object v6

    iput-object v6, v5, Lcom/openfeint/internal/resource/ServerException;->message:Ljava/lang/String;

    .line 269
    iget-object v6, v5, Lcom/openfeint/internal/resource/ServerException;->message:Ljava/lang/String;

    if-nez v6, :cond_1

    .line 270
    const v6, 0x7f040006

    invoke-static {v6}, Lcom/openfeint/internal/OpenFeintInternal;->getRString(I)Ljava/lang/String;

    move-result-object v6

    iput-object v6, v5, Lcom/openfeint/internal/resource/ServerException;->message:Ljava/lang/String;

    .line 272
    :cond_1
    invoke-direct {p0, v5}, Lcom/openfeint/internal/request/BaseRequest;->fakeServerException(Lcom/openfeint/internal/resource/ServerException;)V

    goto :goto_0

    .line 209
    .end local v2           #e:Ljava/lang/Exception;
    .end local v5           #se:Lcom/openfeint/internal/resource/ServerException;
    :cond_2
    :try_start_1
    invoke-static {}, Lcom/openfeint/internal/OpenFeintInternal;->getInstance()Lcom/openfeint/internal/OpenFeintInternal;

    move-result-object v6

    invoke-virtual {v6}, Lcom/openfeint/internal/OpenFeintInternal;->getClient()Lorg/apache/http/impl/client/AbstractHttpClient;

    move-result-object v0

    .line 210
    .local v0, client:Lorg/apache/http/impl/client/AbstractHttpClient;
    new-instance v1, Lorg/apache/http/protocol/BasicHttpContext;

    invoke-direct {v1}, Lorg/apache/http/protocol/BasicHttpContext;-><init>()V

    .line 211
    .local v1, context:Lorg/apache/http/protocol/HttpContext;
    new-instance v3, Lcom/openfeint/internal/request/BaseRequest$1;

    invoke-direct {v3, p0, v1}, Lcom/openfeint/internal/request/BaseRequest$1;-><init>(Lcom/openfeint/internal/request/BaseRequest;Lorg/apache/http/protocol/HttpContext;)V

    .line 251
    .local v3, handler:Lorg/apache/http/client/ResponseHandler;,"Lorg/apache/http/client/ResponseHandler<Ljava/lang/Object;>;"
    iget-object v6, p0, Lcom/openfeint/internal/request/BaseRequest;->mRequest:Lorg/apache/http/client/methods/HttpUriRequest;

    invoke-virtual {v0, v6, v3, v1}, Lorg/apache/http/impl/client/AbstractHttpClient;->execute(Lorg/apache/http/client/methods/HttpUriRequest;Lorg/apache/http/client/ResponseHandler;Lorg/apache/http/protocol/HttpContext;)Ljava/lang/Object;

    .line 253
    const/4 v6, 0x0

    iput-object v6, p0, Lcom/openfeint/internal/request/BaseRequest;->mRequest:Lorg/apache/http/client/methods/HttpUriRequest;
    :try_end_1
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_0

    .line 200
    .end local v0           #client:Lorg/apache/http/impl/client/AbstractHttpClient;
    .end local v1           #context:Lorg/apache/http/protocol/HttpContext;
    .end local v3           #handler:Lorg/apache/http/client/ResponseHandler;,"Lorg/apache/http/client/ResponseHandler<Ljava/lang/Object;>;"
    :cond_3
    iget-object v6, p0, Lcom/openfeint/internal/request/BaseRequest;->mResponseBody:[B

    if-eqz v6, :cond_0

    goto/16 :goto_0
.end method

.method protected genEntity()Lorg/apache/http/HttpEntity;
    .locals 4
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/UnsupportedEncodingException;
        }
    .end annotation

    .prologue
    .line 129
    const-string v0, "UTF-8"

    .line 130
    .local v0, encoding:Ljava/lang/String;
    new-instance v1, Lorg/apache/http/client/entity/UrlEncodedFormEntity;

    iget-object v2, p0, Lcom/openfeint/internal/request/BaseRequest;->mArgs:Lcom/openfeint/internal/request/OrderedArgList;

    invoke-virtual {v2}, Lcom/openfeint/internal/request/OrderedArgList;->getArgs()Ljava/util/List;

    move-result-object v2

    invoke-direct {v1, v2, v0}, Lorg/apache/http/client/entity/UrlEncodedFormEntity;-><init>(Ljava/util/List;Ljava/lang/String;)V

    .line 131
    .local v1, entity:Lorg/apache/http/client/entity/UrlEncodedFormEntity;
    new-instance v2, Ljava/lang/StringBuilder;

    const-string v3, "application/x-www-form-urlencoded; charset="

    invoke-direct {v2, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v1, v2}, Lorg/apache/http/client/entity/UrlEncodedFormEntity;->setContentType(Ljava/lang/String;)V

    .line 132
    return-object v1
.end method

.method protected generateRequest()Lorg/apache/http/client/methods/HttpUriRequest;
    .locals 9

    .prologue
    .line 136
    const/4 v4, 0x0

    .line 137
    .local v4, retval:Lorg/apache/http/client/methods/HttpUriRequest;
    invoke-virtual {p0}, Lcom/openfeint/internal/request/BaseRequest;->method()Ljava/lang/String;

    move-result-object v2

    .line 139
    .local v2, meth:Ljava/lang/String;
    const-string v6, "GET"

    invoke-virtual {v2, v6}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v6

    if-nez v6, :cond_0

    const-string v6, "DELETE"

    invoke-virtual {v2, v6}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v6

    if-eqz v6, :cond_5

    .line 140
    :cond_0
    invoke-virtual {p0}, Lcom/openfeint/internal/request/BaseRequest;->url()Ljava/lang/String;

    move-result-object v5

    .line 141
    .local v5, url:Ljava/lang/String;
    iget-object v6, p0, Lcom/openfeint/internal/request/BaseRequest;->mArgs:Lcom/openfeint/internal/request/OrderedArgList;

    invoke-virtual {v6}, Lcom/openfeint/internal/request/OrderedArgList;->getArgString()Ljava/lang/String;

    move-result-object v0

    .line 142
    .local v0, argString:Ljava/lang/String;
    if-eqz v0, :cond_1

    .line 143
    new-instance v6, Ljava/lang/StringBuilder;

    invoke-static {v5}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v7

    invoke-direct {v6, v7}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v7, "?"

    invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v6

    invoke-virtual {v6, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v6

    invoke-virtual {v6}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v5

    .line 145
    :cond_1
    const-string v6, "GET"

    invoke-virtual {v2, v6}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v6

    if-eqz v6, :cond_4

    new-instance v4, Lorg/apache/http/client/methods/HttpGet;

    .end local v4           #retval:Lorg/apache/http/client/methods/HttpUriRequest;
    invoke-direct {v4, v5}, Lorg/apache/http/client/methods/HttpGet;-><init>(Ljava/lang/String;)V

    .line 164
    .end local v0           #argString:Ljava/lang/String;
    .end local v5           #url:Ljava/lang/String;
    .restart local v4       #retval:Lorg/apache/http/client/methods/HttpUriRequest;
    :cond_2
    :goto_0
    invoke-virtual {p0}, Lcom/openfeint/internal/request/BaseRequest;->signed()Z

    move-result v6

    if-eqz v6, :cond_3

    iget-object v6, p0, Lcom/openfeint/internal/request/BaseRequest;->mSignature:Ljava/lang/String;

    if-eqz v6, :cond_3

    iget-object v6, p0, Lcom/openfeint/internal/request/BaseRequest;->mKey:Ljava/lang/String;

    if-eqz v6, :cond_3

    .line 165
    const-string v6, "X-OF-Signature"

    iget-object v7, p0, Lcom/openfeint/internal/request/BaseRequest;->mSignature:Ljava/lang/String;

    invoke-interface {v4, v6, v7}, Lorg/apache/http/client/methods/HttpUriRequest;->addHeader(Ljava/lang/String;Ljava/lang/String;)V

    .line 166
    const-string v6, "X-OF-Key"

    iget-object v7, p0, Lcom/openfeint/internal/request/BaseRequest;->mKey:Ljava/lang/String;

    invoke-interface {v4, v6, v7}, Lorg/apache/http/client/methods/HttpUriRequest;->addHeader(Ljava/lang/String;Ljava/lang/String;)V

    .line 169
    :cond_3
    invoke-virtual {p0, v4}, Lcom/openfeint/internal/request/BaseRequest;->addParams(Lorg/apache/http/client/methods/HttpUriRequest;)V

    .line 171
    return-object v4

    .line 146
    .restart local v0       #argString:Ljava/lang/String;
    .restart local v5       #url:Ljava/lang/String;
    :cond_4
    const-string v6, "DELETE"

    invoke-virtual {v2, v6}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v6

    if-eqz v6, :cond_2

    new-instance v4, Lorg/apache/http/client/methods/HttpDelete;

    .end local v4           #retval:Lorg/apache/http/client/methods/HttpUriRequest;
    invoke-direct {v4, v5}, Lorg/apache/http/client/methods/HttpDelete;-><init>(Ljava/lang/String;)V

    .restart local v4       #retval:Lorg/apache/http/client/methods/HttpUriRequest;
    goto :goto_0

    .line 148
    .end local v0           #argString:Ljava/lang/String;
    .end local v5           #url:Ljava/lang/String;
    :cond_5
    const/4 v3, 0x0

    .line 150
    .local v3, postReq:Lorg/apache/http/client/methods/HttpEntityEnclosingRequestBase;
    const-string v6, "POST"

    invoke-virtual {v2, v6}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v6

    if-eqz v6, :cond_6

    new-instance v3, Lorg/apache/http/client/methods/HttpPost;

    .end local v3           #postReq:Lorg/apache/http/client/methods/HttpEntityEnclosingRequestBase;
    invoke-virtual {p0}, Lcom/openfeint/internal/request/BaseRequest;->url()Ljava/lang/String;

    move-result-object v6

    invoke-direct {v3, v6}, Lorg/apache/http/client/methods/HttpPost;-><init>(Ljava/lang/String;)V

    .line 155
    .restart local v3       #postReq:Lorg/apache/http/client/methods/HttpEntityEnclosingRequestBase;
    :goto_1
    :try_start_0
    invoke-virtual {p0}, Lcom/openfeint/internal/request/BaseRequest;->genEntity()Lorg/apache/http/HttpEntity;

    move-result-object v6

    invoke-virtual {v3, v6}, Lorg/apache/http/client/methods/HttpEntityEnclosingRequestBase;->setEntity(Lorg/apache/http/HttpEntity;)V
    :try_end_0
    .catch Ljava/io/UnsupportedEncodingException; {:try_start_0 .. :try_end_0} :catch_0

    .line 161
    :goto_2
    move-object v4, v3

    goto :goto_0

    .line 151
    :cond_6
    const-string v6, "PUT"

    invoke-virtual {v2, v6}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v6

    if-eqz v6, :cond_7

    new-instance v3, Lorg/apache/http/client/methods/HttpPut;

    .end local v3           #postReq:Lorg/apache/http/client/methods/HttpEntityEnclosingRequestBase;
    invoke-virtual {p0}, Lcom/openfeint/internal/request/BaseRequest;->url()Ljava/lang/String;

    move-result-object v6

    invoke-direct {v3, v6}, Lorg/apache/http/client/methods/HttpPut;-><init>(Ljava/lang/String;)V

    .restart local v3       #postReq:Lorg/apache/http/client/methods/HttpEntityEnclosingRequestBase;
    goto :goto_1

    .line 152
    :cond_7
    new-instance v6, Ljava/lang/RuntimeException;

    new-instance v7, Ljava/lang/StringBuilder;

    const-string v8, "Unsupported HTTP method: "

    invoke-direct {v7, v8}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v7, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v7

    invoke-virtual {v7}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v7

    invoke-direct {v6, v7}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;)V

    throw v6

    .line 156
    :catch_0
    move-exception v6

    move-object v1, v6

    .line 157
    .local v1, e:Ljava/io/UnsupportedEncodingException;
    sget-object v6, Lcom/openfeint/internal/request/BaseRequest;->TAG:Ljava/lang/String;

    const-string v7, "Unable to encode request."

    invoke-static {v6, v7}, Lcom/openfeint/internal/OpenFeintInternal;->log(Ljava/lang/String;Ljava/lang/String;)V

    .line 158
    sget-object v6, Ljava/lang/System;->err:Ljava/io/PrintStream;

    invoke-virtual {v1, v6}, Ljava/io/UnsupportedEncodingException;->printStackTrace(Ljava/io/PrintStream;)V

    goto :goto_2
.end method

.method public getFuture()Ljava/util/concurrent/Future;
    .locals 1
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()",
            "Ljava/util/concurrent/Future",
            "<*>;"
        }
    .end annotation

    .prologue
    .line 68
    iget-object v0, p0, Lcom/openfeint/internal/request/BaseRequest;->mFuture:Ljava/util/concurrent/Future;

    return-object v0
.end method

.method protected getHttpParams()Lorg/apache/http/params/HttpParams;
    .locals 1

    .prologue
    .line 72
    iget-object v0, p0, Lcom/openfeint/internal/request/BaseRequest;->mHttpParams:Lorg/apache/http/params/HttpParams;

    if-nez v0, :cond_0

    .line 73
    new-instance v0, Lorg/apache/http/params/BasicHttpParams;

    invoke-direct {v0}, Lorg/apache/http/params/BasicHttpParams;-><init>()V

    iput-object v0, p0, Lcom/openfeint/internal/request/BaseRequest;->mHttpParams:Lorg/apache/http/params/HttpParams;

    .line 75
    :cond_0
    iget-object v0, p0, Lcom/openfeint/internal/request/BaseRequest;->mHttpParams:Lorg/apache/http/params/HttpParams;

    return-object v0
.end method

.method public getResponse()Lorg/apache/http/HttpResponse;
    .locals 1

    .prologue
    .line 291
    iget-object v0, p0, Lcom/openfeint/internal/request/BaseRequest;->response_:Lorg/apache/http/HttpResponse;

    return-object v0
.end method

.method protected getResponseEncoding()Ljava/lang/String;
    .locals 1

    .prologue
    .line 44
    iget-object v0, p0, Lcom/openfeint/internal/request/BaseRequest;->mResponseEncoding:Ljava/lang/String;

    return-object v0
.end method

.method protected getResponseType()Ljava/lang/String;
    .locals 1

    .prologue
    .line 45
    iget-object v0, p0, Lcom/openfeint/internal/request/BaseRequest;->mResponseType:Ljava/lang/String;

    return-object v0
.end method

.method public launch()V
    .locals 0

    .prologue
    .line 314
    invoke-static {p0}, Lcom/openfeint/internal/OpenFeintInternal;->makeRequest(Lcom/openfeint/internal/request/BaseRequest;)V

    .line 315
    return-void
.end method

.method public abstract method()Ljava/lang/String;
.end method

.method public needsDeviceSession()Z
    .locals 1

    .prologue
    .line 93
    invoke-virtual {p0}, Lcom/openfeint/internal/request/BaseRequest;->signed()Z

    move-result v0

    return v0
.end method

.method public numRetries()I
    .locals 1

    .prologue
    .line 53
    sget v0, Lcom/openfeint/internal/request/BaseRequest;->DEFAULT_RETRIES:I

    return v0
.end method

.method public final onResponse()V
    .locals 3

    .prologue
    .line 298
    iget-boolean v1, p0, Lcom/openfeint/internal/request/BaseRequest;->mResponded:Z

    if-nez v1, :cond_1

    .line 299
    const/4 v1, 0x1

    iput-boolean v1, p0, Lcom/openfeint/internal/request/BaseRequest;->mResponded:Z

    .line 300
    iget-object v1, p0, Lcom/openfeint/internal/request/BaseRequest;->mResponseBody:[B

    if-nez v1, :cond_0

    .line 302
    const/4 v1, 0x0

    iput v1, p0, Lcom/openfeint/internal/request/BaseRequest;->mResponseCode:I

    .line 303
    new-instance v0, Lcom/openfeint/internal/resource/ServerException;

    invoke-direct {v0}, Lcom/openfeint/internal/resource/ServerException;-><init>()V

    .line 304
    .local v0, se:Lcom/openfeint/internal/resource/ServerException;
    const-string v1, "Unknown"

    iput-object v1, v0, Lcom/openfeint/internal/resource/ServerException;->exceptionClass:Ljava/lang/String;

    .line 305
    const v1, 0x7f040006

    invoke-static {v1}, Lcom/openfeint/internal/OpenFeintInternal;->getRString(I)Ljava/lang/String;

    move-result-object v1

    iput-object v1, v0, Lcom/openfeint/internal/resource/ServerException;->message:Ljava/lang/String;

    .line 306
    invoke-direct {p0, v0}, Lcom/openfeint/internal/request/BaseRequest;->fakeServerException(Lcom/openfeint/internal/resource/ServerException;)V

    .line 308
    .end local v0           #se:Lcom/openfeint/internal/resource/ServerException;
    :cond_0
    iget v1, p0, Lcom/openfeint/internal/request/BaseRequest;->mResponseCode:I

    iget-object v2, p0, Lcom/openfeint/internal/request/BaseRequest;->mResponseBody:[B

    invoke-virtual {p0, v1, v2}, Lcom/openfeint/internal/request/BaseRequest;->onResponse(I[B)V

    .line 309
    const/4 v1, 0x0

    iput-object v1, p0, Lcom/openfeint/internal/request/BaseRequest;->response_:Lorg/apache/http/HttpResponse;

    .line 311
    :cond_1
    return-void
.end method

.method public abstract onResponse(I[B)V
.end method

.method protected onResponseOffMainThread(I[B)V
    .locals 0
    .parameter "responseCode"
    .parameter "body"

    .prologue
    .line 294
    return-void
.end method

.method public abstract path()Ljava/lang/String;
.end method

.method public postTimeoutCleanup()V
    .locals 4

    .prologue
    .line 318
    iget-object v0, p0, Lcom/openfeint/internal/request/BaseRequest;->mRequest:Lorg/apache/http/client/methods/HttpUriRequest;

    .line 319
    .local v0, req:Lorg/apache/http/client/methods/HttpUriRequest;
    const/4 v2, 0x0

    iput-object v2, p0, Lcom/openfeint/internal/request/BaseRequest;->mRequest:Lorg/apache/http/client/methods/HttpUriRequest;

    .line 321
    if-eqz v0, :cond_0

    .line 324
    new-instance v2, Ljava/lang/Thread;

    new-instance v3, Lcom/openfeint/internal/request/BaseRequest$2;

    invoke-direct {v3, p0, v0}, Lcom/openfeint/internal/request/BaseRequest$2;-><init>(Lcom/openfeint/internal/request/BaseRequest;Lorg/apache/http/client/methods/HttpUriRequest;)V

    invoke-direct {v2, v3}, Ljava/lang/Thread;-><init>(Ljava/lang/Runnable;)V

    .line 332
    invoke-virtual {v2}, Ljava/lang/Thread;->start()V

    .line 335
    :cond_0
    new-instance v1, Lcom/openfeint/internal/resource/ServerException;

    invoke-direct {v1}, Lcom/openfeint/internal/resource/ServerException;-><init>()V

    .line 336
    .local v1, se:Lcom/openfeint/internal/resource/ServerException;
    const-string v2, "Timeout"

    iput-object v2, v1, Lcom/openfeint/internal/resource/ServerException;->exceptionClass:Ljava/lang/String;

    .line 337
    const v2, 0x7f040019

    invoke-static {v2}, Lcom/openfeint/internal/OpenFeintInternal;->getRString(I)Ljava/lang/String;

    move-result-object v2

    iput-object v2, v1, Lcom/openfeint/internal/resource/ServerException;->message:Ljava/lang/String;

    .line 338
    invoke-direct {p0, v1}, Lcom/openfeint/internal/request/BaseRequest;->fakeServerException(Lcom/openfeint/internal/resource/ServerException;)V

    .line 339
    return-void
.end method

.method public final setArgs(Lcom/openfeint/internal/request/OrderedArgList;)V
    .locals 0
    .parameter "args"

    .prologue
    .line 125
    iput-object p1, p0, Lcom/openfeint/internal/request/BaseRequest;->mArgs:Lcom/openfeint/internal/request/OrderedArgList;

    .line 126
    return-void
.end method

.method public setFuture(Ljava/util/concurrent/Future;)V
    .locals 0
    .parameter
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/concurrent/Future",
            "<*>;)V"
        }
    .end annotation

    .prologue
    .line 64
    .local p1, future:Ljava/util/concurrent/Future;,"Ljava/util/concurrent/Future<*>;"
    iput-object p1, p0, Lcom/openfeint/internal/request/BaseRequest;->mFuture:Ljava/util/concurrent/Future;

    .line 65
    return-void
.end method

.method protected shouldRedirect(Ljava/lang/String;)Z
    .locals 1
    .parameter "url"

    .prologue
    .line 174
    const/4 v0, 0x1

    return v0
.end method

.method public final sign(Lcom/openfeint/internal/request/Signer;)V
    .locals 6
    .parameter "authority"

    .prologue
    .line 116
    iget-object v0, p0, Lcom/openfeint/internal/request/BaseRequest;->mArgs:Lcom/openfeint/internal/request/OrderedArgList;

    if-nez v0, :cond_0

    new-instance v0, Lcom/openfeint/internal/request/OrderedArgList;

    invoke-direct {v0}, Lcom/openfeint/internal/request/OrderedArgList;-><init>()V

    iput-object v0, p0, Lcom/openfeint/internal/request/BaseRequest;->mArgs:Lcom/openfeint/internal/request/OrderedArgList;

    .line 117
    :cond_0
    invoke-virtual {p0}, Lcom/openfeint/internal/request/BaseRequest;->signed()Z

    move-result v0

    if-eqz v0, :cond_1

    .line 118
    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v0

    const-wide/16 v2, 0x3e8

    div-long/2addr v0, v2

    iput-wide v0, p0, Lcom/openfeint/internal/request/BaseRequest;->mSecondsSinceEpoch:J

    .line 119
    invoke-virtual {p0}, Lcom/openfeint/internal/request/BaseRequest;->path()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {p0}, Lcom/openfeint/internal/request/BaseRequest;->method()Ljava/lang/String;

    move-result-object v2

    iget-wide v3, p0, Lcom/openfeint/internal/request/BaseRequest;->mSecondsSinceEpoch:J

    iget-object v5, p0, Lcom/openfeint/internal/request/BaseRequest;->mArgs:Lcom/openfeint/internal/request/OrderedArgList;

    move-object v0, p1

    invoke-virtual/range {v0 .. v5}, Lcom/openfeint/internal/request/Signer;->sign(Ljava/lang/String;Ljava/lang/String;JLcom/openfeint/internal/request/OrderedArgList;)Ljava/lang/String;

    move-result-object v0

    iput-object v0, p0, Lcom/openfeint/internal/request/BaseRequest;->mSignature:Ljava/lang/String;

    .line 120
    invoke-virtual {p1}, Lcom/openfeint/internal/request/Signer;->getKey()Ljava/lang/String;

    move-result-object v0

    iput-object v0, p0, Lcom/openfeint/internal/request/BaseRequest;->mKey:Ljava/lang/String;

    .line 122
    :cond_1
    return-void
.end method

.method public signed()Z
    .locals 1

    .prologue
    .line 87
    const/4 v0, 0x1

    return v0
.end method

.method public timeout()J
    .locals 2

    .prologue
    .line 54
    sget-wide v0, Lcom/openfeint/internal/request/BaseRequest;->DEFAULT_TIMEOUT:J

    return-wide v0
.end method

.method public url()Ljava/lang/String;
    .locals 2

    .prologue
    .line 109
    sget-object v0, Lcom/openfeint/internal/request/BaseRequest;->sBaseServerURL:Ljava/lang/String;

    if-nez v0, :cond_0

    .line 110
    invoke-static {}, Lcom/openfeint/internal/OpenFeintInternal;->getInstance()Lcom/openfeint/internal/OpenFeintInternal;

    move-result-object v0

    invoke-virtual {v0}, Lcom/openfeint/internal/OpenFeintInternal;->getServerUrl()Ljava/lang/String;

    move-result-object v0

    sput-object v0, Lcom/openfeint/internal/request/BaseRequest;->sBaseServerURL:Ljava/lang/String;

    .line 112
    :cond_0
    new-instance v0, Ljava/lang/StringBuilder;

    sget-object v1, Lcom/openfeint/internal/request/BaseRequest;->sBaseServerURL:Ljava/lang/String;

    invoke-static {v1}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v1

    invoke-direct {v0, v1}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {p0}, Lcom/openfeint/internal/request/BaseRequest;->path()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public wantsLogin()Z
    .locals 1

    .prologue
    .line 83
    const/4 v0, 0x0

    return v0
.end method
